<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <script type="text/javascript" src="resource/jquery/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="resource/uploadify/jquery.uploadify.min.js"></script>
    <link rel="stylesheet" type="text/css" href="resource/css/student_input.css" />
	<!--日历控件-->
	<script language="javascript" type="text/javascript" src="resource/javascript/My97DatePicker/WdatePicker.js"></script>
	<!--日历控件-->
	{literal}
   	<script type="text/javascript">
   		$(document).ready(function(){

			//判断是否首次加载,实现二级联动
			var major_html = $("#major").html();
			if(major_html == ''){
				getMajor($(this).find("option:selected").text(), $(this).find("option:selected").val());

				majorSelect();
			}

			//改变学院时
			$("#department").change(function(){
				var department_name = $(this).find("option:selected").text();
				var department_val = $(this).find("option:selected").val();
				//alert(department_name + ":" + department_val);
				//$("#major").html("<option value='1'>" + department_name + "</option>");
				
				getMajor(department_name, department_val);

				majorSelect();
			});
			//实现二级联动
   		});
   		
   		
		//显示照片
   		function showPhoto(path){
   			$(document.getElementById('path')).attr('value',path);
   			document.getElementById("stdPhoto").src="image_preview?path="+encodeURI(encodeURI(path));
   		}
   		
   		function openWin() {
   			open("action.php?page=upload&act=update", "uploadpage", "width=500,height=300,left="+(screen.width-500)/2+",top="+(screen.height-150)/2+"");
   		}
		/*====================*/

		
		//获取专业信息
		function getMajor(department_names, department_vals){	
			var queryStr = "";
			var major_ary = new Array();

			//返回格式[{"major_id":"6","major_name":"\u82f1\u8bed","department_id":"3"}]
			$.post("libs/department_service.php?act=ajax", {department_name:department_names, department_val:department_vals}, function(data){
				var result = data;
			
				//清空选项
				$("#major").html("");
				for(var json in result){
					$("#major").html($("#major").html() + "<option value='" + result[json].major_id + "'>" + result[json].major_name + "</option>");
				}
				
			}, 'json');
		}

		//选择专业
		function majorSelect(){
			var student_id = $("#student_id").val();
			$.post("libs/department_service.php?act=major", {'id':student_id}, function(data){
				$("#major option").each(function(){
					if($(this).val() == data){
						$(this).attr("selected", "selected");
					}
				});
			});
		}
   	</script>
	{/literal}
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <body style="font-size:18px;font-family:'微软雅黑'">
  <!-- <div style="width:700px;margin:0px auto;">  -->
  <div style="font-size:30px;text-align:center;margin-bottom:25px">学生信息</div>
  <form action="libs/student_service.php?act=update_student" method="post" class="form1">
  <input type="hidden" name="path" id="path"></input>
  <table width="100%" cellspacing="2" cellpadding="0" border="1" bordercolor="lightblue" height="494px">
  	<tr class="tr_height">
  		<td class="td_head">姓名：</td><td><input type="text" name="name" value="{$student_info.name}"></td>
  		<td class="td_head">学号：</td><td><input type="text" name="id" id="student_id" value="{$student_info.id}"></td>
  		<td rowspan="3" class="td_head">照片：</td>
  		<td rowspan="3" align="center" style="vertical-align:top;">
  				<img src="resource/image/none.jpg" alt="点击上传头像" height="140px" width="140px" onclick="openWin();" id="stdPhoto" style="display:block;"/>
  				<span style="font-size:12px;margin-top:10px;">请上传大小为140*140的图片</span>
  		</td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">学院：</td><td>
			<select id="department" name="department" onchange="findClass(this)" style="width:155px;">
	  			{foreach from=$department_ary item=dep}
				{if $student_info.department_id == $dep.id}
				<option value={$dep.id} selected="selected">{$dep.name}</option>
				{else}
				<option value={$dep.id}>{$dep.name}</option>
				{/if}
				{/foreach}
	  		</select>
	  	</td>
  		<td class="td_head">班级：</td><td>
			<select id="clasz" name="class" style="width:155px;">
				{foreach from=$class_ary item=class}
				{if $student_info.class_id == $class.id}
				<option value={$class.id} selected="selected">{$class.name}</option>
				{else}
				<option value={$class.id}>{$class.name}</option>
				{/if}
				{/foreach}
			</select>
  		</td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">专业：</td><td><select name="major" id="major" style="width:155px;"></select></td>
  		<td class="td_head">身份证：</td><td><input type="text" name="personId" value="{$student_info.personId}"></td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">入学时间：</td><td><input id="enrolTime" type="text" name="enrolTime" value="{$student_info.enrolTime}" onClick="WdatePicker()" readonly="readonly"></td>
  		<td class="td_head">出生日期：</td><td><input id="birthday" type="text" name="birthday" value="{$student_info.birthday}" onClick="WdatePicker()" readonly="readonly"></td>
  		<td class="td_head">性别：</td><td>
			<select name="sex" style="width:155px;">
				{if $student_info.sex == 0}
  				<option value="0" selected="selected">男</option>
				<option value="1">女</option>
				{else}
				<option value="0">男</option>
  				<option value="1" selected="selected">女</option>
				{/if}
  			</select>
		</td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">政治面貌：</td><td><select name="party" style="width:155px;">
  				{foreach from=$party_ary item=party}
				{if $student_info.party == $party.party_id}
				<option value=$party.party_id selected="selected">{$party.party_name}</option>
				{else}
				<option value=$party.party_id>{$party.party_name}</option>
				{/if}

				{/foreach}
  			</select></td>
  		<td class="td_head">籍贯：</td><td><input type="text" name="province" value="{$student_info.province}"></td>
  		<td class="td_head">民族：</td><td><input type="text" name="race" value="{$student_info.race}"></td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">联系电话：</td><td><input type="text" name="phone" value="{$student_info.phone}"></td>
  		<td class="td_head">家庭地址：</td><td><input type="text" name="address" value="{$student_info.address}"></td>
  		<td class="td_head">电子邮箱：</td><td><input type="text" name="email" value="{$student_info.email}"/></td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">家人电话：</td><td><input type="text" name="familyTel" value="{$student_info.familyTel}"></td>
  		<td class="td_head">学制：</td><td><input type="text" name="eduSystme" value="{$student_info.eduSystme}"></td>
  		<td class="td_head" rowspan="2">备注：</td><td rowspan="2"><textarea style="resize:none;width:100%;height:100%;border:0;" name="remark">{$student_info.remark}</textarea></td>
  	</tr>
  	<tr class="tr_height">
  		<td class="td_head">宿舍号：</td><td><input type="text" name="dormNo" value="{$student_info.dormNo}"></td>
  		<td class="td_head">出生地：</td><td><input type="text" name="birthplace" value="{$student_info.birthplace}"></td>
  	</tr>
  	<tr height="30px" align="center" style="background-color:lightblue;"><td colspan="6"><input style="width:100px;height:30px;" type="submit" value="更新">
  		<input style="width:100px;height:30px;" type="reset" value="重置">
  	</td></tr>
  </table>
 </form>
  <!-- </div>  -->
  </body>
</html>
